package com.ilibrary.base;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class MyBaseAction extends ActionSupport {
	
	protected Logger logger = Logger.getLogger(this.getClass());
	
	protected HttpServletRequest getRQ(){
		return ServletActionContext.getRequest();
	}
	
	protected HttpServletResponse getRP(){
		return ServletActionContext.getResponse();
	}
	
	protected HttpSession getSSN(){
		return this.getRQ().getSession();
	}
	
	protected PrintWriter getPW() throws IOException {
		return this.getRP().getWriter();
	}
	
	protected void setCharacterEncoding() {
		this.getRP().setCharacterEncoding("UTF-8");
		this.getRP().setCharacterEncoding("UTF-8");
	}
	
}
